#pragma once 
#include <exception>
#include <string>
#include <Windows.h>

using std::exception;
using std::string;
class ErrorException : public exception
{
private:
	bool _useErrorCode;
	int _errorCode;
public:
	ErrorException(const char* message, bool useErrorCode = false) : exception(message)
	{
		_useErrorCode = useErrorCode;
		_errorCode = 0;
		if (_useErrorCode)
		{
			_errorCode = ::GetLastError();
		}

	}

	int GetErrorCode()
	{
		return _useErrorCode ? _errorCode : ::GetLastError();
	}
};

class FileNotFoundException : public exception
{
public:	FileNotFoundException(string fileName) : exception((fileName.append(" file is not exist.")).c_str()) {	}
};

class InvlidOperationException : public ErrorException
{
public:	InvlidOperationException(const char* message, bool useErrorCode = false) : ErrorException(message, useErrorCode) {	}
};